x86/p2m: adjust non-PoD accounting in p2m_pod_decrease_reservation()
authorJan Beulich <jbeulich@suse.com>
Fri, 21 Feb 2020 16:15:22 +0000 (17:15 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 21 Feb 2020 16:15:22 +0000 (17:15 +0100)
commit578f90e3e5e7075e93caeb35625be820e618e856
treec1bda0a4e3d1843386ff0701e497194b471ccc1d
parentaea270e3f7c0db696c88a0e94b1ece7abd339c84
x86/p2m: adjust non-PoD accounting in p2m_pod_decrease_reservation()

Throughout the function the equation

pod + nonpod == (1UL << order)

should hold. This has been violated by the final loop of the function:
* changing a range from a type other than p2m_populate_on_demand to
  p2m_invalid doesn't alter the amount of non-PoD pages in the region,
* changing a range from p2m_populate_on_demand to p2m_invalid does
  increase the amount of non-PoD pages in the region along with
  decreasing the amount of PoD pages there.
Fortunately the variable isn't used anymore after the loop. Instead of
correcting the updating of the "nonpod" variable, however, drop it
altogether, to avoid getting the above equation to not hold again by a
future change.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/mm/p2m-pod.c